:root {
            --primary-color: #4f46e5;
            --primary-light: #6366f1;
            --bg-color: #f9fafb;
            --card-bg: #ffffff;
            --text-color: #1f2937;
            --border-color: #e5e7eb;
            --assistant-bg: #f3f4f6;
            --user-bg: #e0e7ff;
            --success-color: #10b981;
            --error-color: #ef4444;
            --warning-color: #f59e0b;
            --free-color: #10b981;
            --role-color: #8b5cf6;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
        }

        body {
            background-color: var(--bg-color);
            color: var(--text-color);
            line-height: 1.6;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px;
            display: flex;
            flex-direction: column;
            min-height: 100vh;
        }

        header {
            text-align: center;
            margin-bottom: 30px;
            padding-bottom: 20px;
            border-bottom: 1px solid var(--border-color);
        }

        h1 {
            color: var(--primary-color);
            margin-bottom: 10px;
        }

        .main-content {
            display: flex;
            flex: 1;
            gap: 20px;
        }

        @media (max-width: 768px) {
            .main-content {
                flex-direction: column;
            }
        }

        .config-section {
            flex: 1;
            background: var(--card-bg);
            border-radius: 12px;
            padding: 20px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
            display: flex;
            flex-direction: column;
        }

        .chat-section {
            flex: 2;
            display: flex;
            flex-direction: column;
            background: var(--card-bg);
            border-radius: 12px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
            overflow: hidden;
        }

        .form-group {
            margin-bottom: 20px;
        }

        label {
            display: block;
            margin-bottom: 8px;
            font-weight: 500;
        }

        input, select, textarea {
            width: 100%;
            padding: 10px 12px;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            font-size: 14px;
            transition: border-color 0.2s;
        }

        input:focus, select:focus, textarea:focus {
            outline: none;
            border-color: var(--primary-color);
        }

        button {
            background-color: var(--primary-color);
            color: white;
            border: none;
            padding: 10px 16px;
            border-radius: 6px;
            cursor: pointer;
            font-weight: 500;
            transition: background-color 0.2s;
        }

        button:hover {
            background-color: var(--primary-light);
        }

        button:disabled {
            background-color: #9ca3af;
            cursor: not-allowed;
        }

        .chat-header {
            padding: 15px 20px;
            border-bottom: 1px solid var(--border-color);
            font-weight: 600;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .chat-messages {
            flex: 1;
            padding: 20px;
            overflow-y: auto;
            max-height: 60vh;
        }

        .message {
            margin-bottom: 20px;
            display: flex;
        }

        .message.user {
            justify-content: flex-end;
        }

        .message-content {
            max-width: 80%;
            padding: 12px 16px;
            border-radius: 12px;
            position: relative;
        }

        .user .message-content {
            background-color: var(--user-bg);
            border-top-right-radius: 4px;
        }

        .assistant .message-content {
            background-color: var(--assistant-bg);
            border-top-left-radius: 4px;
        }

        .message-role {
            font-size: 12px;
            font-weight: 600;
            margin-bottom: 4px;
            color: #6b7280;
        }
        
        /* Markdown内容样式支持 */
        .message-content h1, .message-content h2, .message-content h3, 
        .message-content h4, .message-content h5, .message-content h6 {
            margin: 10px 0 5px 0;
            padding: 0;
            color: var(--text-color);
        }

        .message-content h1 { font-size: 1.5em; }
        .message-content h2 { font-size: 1.3em; }
        .message-content h3 { font-size: 1.2em; }
        .message-content h4, .message-content h5, .message-content h6 { font-size: 1.1em; }

        /* 段落样式 */
        .message-content p {
            margin: 10px 0;
            line-height: 1.6;
        }

        /* 列表样式 */
        .message-content ul, .message-content ol {
            margin: 10px 0;
            padding-left: 20px;
        }

        .message-content li {
            margin: 5px 0;
        }

        /* 引用块样式 */
        .message-content blockquote {
            margin: 10px 0;
            padding: 8px 15px;
            background-color: #f9f9f9;
            border-left: 4px solid var(--primary-light);
            font-style: italic;
        }

        /* 表格样式 */
        .message-content table {
            width: 100%;
            border-collapse: collapse;
            margin: 10px 0;
            overflow-x: auto;
            display: block;
        }

        .message-content th, .message-content td {
            padding: 8px 12px;
            border: 1px solid var(--border-color);
            text-align: left;
        }

        .message-content th {
            background-color: #f2f2f2;
            font-weight: bold;
        }

        .message-content tr:nth-child(even) {
            background-color: #f9f9f9;
        }

        /* 代码块样式 */
        .message-content pre {
            margin: 10px 0;
            padding: 10px;
            background-color: #f5f5f5;
            border-radius: 5px;
            overflow-x: auto;
            font-family: 'Courier New', Courier, monospace;
            white-space: pre-wrap;
            word-break: break-all;
        }

        .message-content code {
            padding: 2px 4px;
            background-color: #f5f5f5;
            border-radius: 3px;
            font-family: 'Courier New', Courier, monospace;
        }

        .message-content pre code {
            padding: 0;
            background-color: transparent;
            white-space: pre-wrap;
            word-break: break-all;
        }

        /* 链接样式 */
        .message-content a {
            color: var(--primary-color);
            text-decoration: none;
        }

        .message-content a:hover {
            text-decoration: underline;
        }

        /* 强调样式 */
        .message-content strong {
            font-weight: bold;
        }

        .message-content em {
            font-style: italic;
        }

        /* 响应式表格 */
        @media (max-width: 768px) {
            .message-content table {
                display: block;
                width: 100%;
                overflow-x: auto;
            }
        }

        /* 滚动条样式优化 */
        .message-content ::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }

        .message-content ::-webkit-scrollbar-track {
            background: #f1f1f1;
            border-radius: 4px;
        }

        .message-content ::-webkit-scrollbar-thumb {
            background: #c1c1c1;
            border-radius: 4px;
        }

        .message-content ::-webkit-scrollbar-thumb:hover {
            background: #a8a8a8;
        }

        .chat-input {
            padding: 20px;
            border-top: 1px solid var(--border-color);
            display: flex;
            gap: 10px;
        }

        .chat-input textarea {
            flex: 1;
            padding: 12px;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            resize: none;
            font-size: 14px;
            min-height: 60px;
            max-height: 120px;
        }

        .chat-input textarea:focus {
            outline: none;
            border-color: var(--primary-color);
        }

        .api-status {
            margin-top: 20px;
            padding: 12px;
            border-radius: 6px;
            font-size: 14px;
            display: none;
        }

        .api-status.success {
            background-color: #d1fae5;
            color: #065f46;
            display: block;
        }

        .api-status.error {
            background-color: #fee2e2;
            color: #991b1b;
            display: block;
        }

        .typing-indicator {
            display: none;
            padding: 12px 16px;
            background-color: var(--assistant-bg);
            border-radius: 12px;
            border-top-left-radius: 4px;
            max-width: 80%;
            margin-bottom: 20px;
        }

        .typing-dots {
            display: flex;
            gap: 4px;
        }

        .typing-dots span {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background-color: #9ca3af;
            animation: typing 1.4s infinite ease-in-out;
        }

        .typing-dots span:nth-child(1) { animation-delay: 0s; }
        .typing-dots span:nth-child(2) { animation-delay: 0.2s; }
        .typing-dots span:nth-child(3) { animation-delay: 0.4s; }

        @keyframes typing {
            0%, 60%, 100% { transform: translateY(0); }
            30% { transform: translateY(-5px); }
        }

        .config-actions {
            display: flex;
            gap: 10px;
            margin-top: 20px;
        }

        .config-actions button {
            flex: 1;
        }

        .config-actions button.secondary {
            background-color: #6b7280;
        }

        .config-actions button.secondary:hover {
            background-color: #4b5563;
        }

        .model-info {
            margin-top: 8px;
            font-size: 12px;
            color: #6b7280;
            display: none;
        }

        .model-info.active {
            display: block;
        }

        .model-info span {
            display: inline-block;
            margin-right: 10px;
            padding: 2px 6px;
            border-radius: 4px;
            background-color: #f3f4f6;
        }

        .free-tag {
            color: var(--free-color);
            font-weight: 600;
        }

        .model-type {
            margin-bottom: 10px;
            font-weight: 600;
            color: var(--primary-color);
            border-bottom: 1px solid var(--border-color);
            padding-bottom: 5px;
        }

        .role-management {
            margin-top: 20px;
            border-top: 1px solid var(--border-color);
            padding-top: 20px;
        }

        .role-buttons {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-bottom: 15px;
        }

        .role-button {
            background-color: var(--role-color);
            color: white;
            border: none;
            padding: 8px 12px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 14px;
            transition: all 0.2s;
        }

        .role-button:hover {
            background-color: #7c3aed;
        }

        .role-button.active {
            background-color: #6d28d9;
            box-shadow: 0 0 0 2px #c4b5fd;
        }

        .role-editor {
            margin-top: 15px;
            padding: 15px;
            background-color: #f8fafc;
            border-radius: 8px;
            border: 1px solid var(--border-color);
            display: none;
        }

        .role-editor.active {
            display: block;
        }

        .role-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 10px;
        }

        .role-name-input {
            flex: 1;
            margin-right: 10px;
        }

        .role-actions {
            display: flex;
            gap: 8px;
        }

        .role-actions button {
            padding: 6px 10px;
            font-size: 12px;
        }

        .delete-role {
            background-color: var(--error-color);
        }

        .delete-role:hover {
            background-color: #dc2626;
        }

        .role-prompt {
            width: 100%;
            min-height: 120px;
            font-family: monospace;
            font-size: 13px;
        }

        .current-role {
            font-size: 14px;
            color: var(--role-color);
            font-weight: 600;
        }

        .config-content {
            flex: 1;
            overflow-y: auto;
        }